Skip to content

integrated rln DoS protection into mix and ran basic scenarios successfully#3693

Draft
chaitanyaprem wants to merge 2 commits into
masterfrom
poc/mix-spam-protection
Draft

integrated rln DoS protection into mix and ran basic scenarios successfully#3693
chaitanyaprem wants to merge 2 commits into
masterfrom
poc/mix-spam-protection

Conversation

@chaitanyaprem
Copy link
Copy Markdown
Contributor

@chaitanyaprem chaitanyaprem commented Jan 23, 2026

Description

Still a work in progress.
This integrates RLN as spam protection mechanism to be used for mix.
As of now it uses OffChainGroupManager and logos-messaging for broadcasting membership changes and general coordination.
Rate limit is currently set to 100msgs per 10secs per node (any mix node).

Note that i don't want to merge this until we integrate RLN membership management with a smart contract in Logos blockchain is merged.

Dependency

This branch carries the extended kademlia discovery integration as one of its commits (cherry-picked from the original pre-rebase tip). That kademlia work is being delivered separately in #3850 (feat: kademlia discovery). Merge plan: this PR should not be merged until #3850 is merged + tested on master, after which this branch will be rebased on top of master and the duplicate kademlia content dropped.

Issue

closes #

Comment thread waku/node/kernel_api/relay.nim Outdated
let uniqueTopicHandler = proc(
topic: PubsubTopic, msg: WakuMessage
): Future[void] {.async, gcsafe.} =
# TODO: Why are all these synchronous in nature? wouldn't it be better to run them concurrently?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ivansete-status i have noticed that these topic handles are called one after the other.
I don't see any reason to not call them concurrently which might make relay message local processing faster.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 26, 2026

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3693

Built from a926778

@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 6722406 to c2b0629 Compare January 27, 2026 13:40
@chaitanyaprem chaitanyaprem changed the title integrated rln spam protection into mix and compiled successfully integrated rln spam protection into mix and ran basic scenarios successfully Jan 30, 2026
@chaitanyaprem chaitanyaprem force-pushed the poc/logos-testnet-mix branch 2 times, most recently from 0cd0581 to 5669cd5 Compare February 11, 2026 05:48
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch 2 times, most recently from eba5d43 to aa9bbe3 Compare February 11, 2026 06:13
@github-actions
Copy link
Copy Markdown

This PR may contain changes to database schema of one of the drivers.

If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues.

Please make sure the label release-notes is added to make sure upgrade instructions properly highlight this change.

@chaitanyaprem chaitanyaprem force-pushed the poc/logos-testnet-mix branch 2 times, most recently from b44e51b to 45aad88 Compare February 11, 2026 06:20
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from aa9bbe3 to 9ae3f04 Compare February 11, 2026 06:20
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 9ae3f04 to 5de7d32 Compare February 11, 2026 06:27
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 5de7d32 to 30b1a16 Compare February 11, 2026 07:03
@chaitanyaprem chaitanyaprem force-pushed the poc/logos-testnet-mix branch 2 times, most recently from a8fe3f3 to ab123e4 Compare February 12, 2026 05:25
@chaitanyaprem chaitanyaprem requested a review from fcecin February 12, 2026 05:55
@chaitanyaprem chaitanyaprem force-pushed the poc/logos-testnet-mix branch 2 times, most recently from 2f478bb to 03bcaf1 Compare February 13, 2026 12:46
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 1de6797 to fb93fc7 Compare February 13, 2026 13:34
@chaitanyaprem chaitanyaprem changed the base branch from poc/logos-testnet-mix to feat/waku-kademlia-mix February 13, 2026 13:34
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from fb93fc7 to 454a9f6 Compare February 16, 2026 09:49
Base automatically changed from feat/waku-kademlia-mix to master February 19, 2026 04:56
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 5b80bac to 7a5b09a Compare March 27, 2026 06:54
@chaitanyaprem chaitanyaprem changed the title integrated rln spam protection into mix and ran basic scenarios successfully integrated rln DoS protection into mix and ran basic scenarios successfully May 5, 2026
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 7d54103 to 6761b66 Compare May 20, 2026 11:29
chaitanyaprem and others added 2 commits May 20, 2026 17:26
…rotection

Rebased poc/mix-spam-protection onto origin/master. Bundles:

- Extended kademlia discovery integration for mix node pool
  (waku/discovery/waku_kademlia.nim, tools/confutils/cli_args.nim)
- RLN spam protection plugin (vacp2p/mix-rln-spam-protection) wired in:
  WakuMix gains mixRlnSpamProtection + publishMessage callback,
  per-hop proof generation / verification, membership coordination
  via /mix/rln/metadata/v1 content topic
- chat2mix sim app: filter-subscribes to spam-protection coordination
  topic, defers publishing until mix node pool is populated
- Makefile: automated librln_mix_v2.0.0.a build via
  scripts/build_rln_mix.sh and mix-librln target
- simulations/mixnet: 5-node mixnet sim infrastructure
  (config1-4.toml, run_*.sh, build_setup.sh, setup_credentials.nim,
  README, roundtrip_check.sh automated round-trip verification)

Rebase fixes:
- Plugin previously vendored as submodule; now a nimble requires entry
  pinned to logos-co/mix-rln-spam-protection-plugin@037f8e10
- waku.nimble: zlib < 0.2 pin to keep nimble lock resolution stable
  (upstream zlib HEAD bumped to 0.2.0)
- apps/chat2mix/config_chat2mix.nim: replace
  `defaultValue: parseIpAddress("...")` with IpAddress literal,
  works around confutils macro generating
  `defaultValueHelpName(): string {.raises: [].}` that violates the
  raises pragma when stringifying a parseIpAddress call
- config.nims: nimble setup --noNimblePath reordering

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… retry

WakuMix.start() previously ran a single sequential pipeline that ended
with mixRlnSpamProtection.registerSelf() — which publishes the new
member's idCommitment to other mix nodes via relay. With master's flow
(switch.start() then reconnectRelayPeers() then ...), running registerSelf
inline would either:
  - block startup for ~62s when reconnectRelayPeers backs off, or
  - run before relay peers exist and silently no-op.

Split the start() proc into:
  - method start*(WakuMix): local-only init (cred load, tree restore,
    plugin start). Safe to await before peers are connected.
  - proc registerDoSProtectionWithNetwork*(WakuMix): kick off a background
    task that retries registerSelf + saveTree indefinitely until the
    broadcast lands. Cancelled when WakuMix.stop() is invoked.

waku_node.start() now wires these in order:
  switch.start()
  wakuMix.start()                   # local init, errors propagate
  reconnectRelayPeers()             # may back off; no longer blocks mix
  wakuMix.registerDoSProtectionWithNetwork()  # fire-and-forget retry
  node.started = true

Re-call safety: registerDoSProtectionWithNetwork no-ops if a prior task
is still running. Lifecycle: WakuMix.stop() cancelAndWait()s the task
before calling plugin.stop().

For keystore-loaded nodes the first attempt early-returns successfully
(membershipIndex already set); the retry path only exercises for fresh
joins where the initial broadcast hits a not-yet-subscribed network.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chaitanyaprem chaitanyaprem force-pushed the poc/mix-spam-protection branch from 6761b66 to f8ebf4d Compare May 20, 2026 11:59
@chaitanyaprem chaitanyaprem marked this pull request as ready for review May 20, 2026 12:18
@chaitanyaprem chaitanyaprem marked this pull request as draft May 20, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant